package utils;

import java.io.Serializable;

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;

public class GerarBD {

	public static void main(String[] args) throws Exception {
		gerarBD();
	}

	private static void gerarBD() {
		
		Configuration cfg = new AnnotationConfiguration();
		cfg.configure("hibernate.cfg.xml");
		SchemaExport export = new SchemaExport(cfg);
		export.create(true, true);
	}

	private static void atualizarBD() {
		SchemaUpdate export = new SchemaUpdate(getConfiguration());
		export.execute(true, true);
	}

	private static Configuration getConfiguration() {
		return new Configuration().configure();
	}
}